<template>
    <div style="width: 100%;height:100%;" v-loading="loading">
        <div style="position: absolute;top:150px;left: 330px;width:400px;">
            <img src="@/assets/提问.png" style="position:absolute; width: 50px;" />
            <h1 style="font-size:23px;position:absolute;left:60px;top:7px;font-weight: 1000;">我是小敏，很高兴见到你</h1>
            <label style="position:absolute;top:65px;left:-15px;font-weight: 1000;">我可以为你制作教学计划和PPT，请把任务交给我吧^_^</label>
        </div>
        <div style=" background-color:#F3F4F6;width:600px;height:100px;border-radius: 10px;border: #409EFF 1px solid;padding: 5px;position: absolute;top:270px;left:210px;">
            <textarea
                class="custom-textarea"
                placeholder="请把任务交给小敏"
                v-model="input"
                @keydown.enter="AIPlease"
            ></textarea>
            <img style="width: 40px;height:43px;position:relative;left:550px;top:-8px;" src="@/assets/提交.png" @click="AIPlease"/>
        </div>
    </div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router';
import { ElMessage } from 'element-plus'
const router = useRouter();
const input = ref('')
const loading = ref(false)

import { useCounterStore } from '@/stores/counter';

const Store = useCounterStore();
function AIPlease(){
    //提问后事件
    if(input.value===''){
        ElMessage('小敏提醒您:记得输入要求噢！')
    }else{
        loading.value=true;
        if (router.currentRoute.value.path !== "/AITeach/Step") {
            localStorage.setItem('AIClassQuestion', input.value) 
            const add =Store.$state.local+ "/AITeach/Step";
            window.open(add, "_blank");
            // router.replace( "/AITeach/Step");
            loading.value=false;
        } 
    }
}
</script>
<style>
.custom-textarea {
  width: 100%;
  height: 65%; /* 填满父容器的高度 */
  background-color: #F3F4F6;
  border: none; /* 移除边框 */
  overflow-y: auto; /* 允许垂直滚动 */
  resize: none; /* 禁止调整大小 */
  outline: none; /* 移除聚焦时的边框 */
  padding: 5px;
  box-sizing: border-box; /* 包括内边距和边框在内的总宽度和高度 */
  font-size: 18px;
  color: rgb(95, 95, 95);
  /* 隐藏滚动条 */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer and Edge */
}
 
.custom-textarea::-webkit-scrollbar {
  display: none; /* Chrome, Safari, and Opera */
}
</style>